//
//  DBManager.m
//  fmdb_demo
//
//  Created by rujia chen on 15/10/18.
//  Copyright (c) 2015年 dfrz. All rights reserved.
//

#import "DBManager.h"
#import <FMDB/FMDatabase.h>

@interface DBManager(){
    FMDatabase *_fmdb;
}

@end

@implementation DBManager

+ (instancetype)manager{
    static DBManager *_m = nil;
    if (!_m) {
        _m = [[DBManager alloc]init];
    }
    return _m;
}

- (instancetype)init{
    if (self = [super init]) {
        NSString *path = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:@"mynew1.db"];
        _fmdb = [[FMDatabase alloc] initWithPath:path];
        NSLog(@"%@",path);
        if ([_fmdb open]) {
            NSString *sql = @"create table if not exists url_cache(uid integer primary key autoincrement,url varchar(64),pnumber varchar(1000))";
            [_fmdb executeUpdate:sql];
//            [_fmdb close];
        }
    }
    return self;
}



@end
